#include "stdafx.h"
#include "Player.h"
#include "Account.h"

CPlayer::CPlayer(int id, CNetClient* client)
	: m_id(id), m_client(client), m_account(null)
{
}

CPlayer::~CPlayer()
{
	if(m_client)
	{
		m_client->free();
		m_client = null;
	}

	if(m_account)
	{
		m_account->solve();
		m_account->setOnline(false);
		m_account = null;
	}
}

int CPlayer::getId() const
{
	return m_id;
}

CNetClient *CPlayer::getClient() const
{
	return m_client;
}

void CPlayer::setAccount(CAccount* account)
{
	m_account = account;
}

CAccount* CPlayer::getAccount() const
{
	return m_account;
}